package com.betterjr.modules.risk.api.service;

import java.util.Map;

import org.springframework.stereotype.Service;

import com.alibaba.dubbo.config.annotation.Reference;
import com.betterjr.common.utils.Collections3;
import com.betterjr.common.web.AbstarctRemoteApiInvoke;
import com.betterjr.common.web.AjaxRemoteApiParam;
import com.betterjr.modules.account.dubbo.interfaces.ICustInfoService;

@Service
public class RemoteApiCoreQueryAllMoneyInvokeService extends AbstarctRemoteApiInvoke {

    @Reference(interfaceClass = ICustInfoService.class)
    private ICustInfoService custInfoService;

    private final String apiCode = "RAI10001";

    @Override
    public String saveOrFindInvoke(AjaxRemoteApiParam anParam) {

        return custInfoService.webCoreQueryMoney(findProperties(anParam.getParamMap(), "custType").toString());
    }

    @Override
    public boolean supportInvoke(String anApiCode) {

        return apiCode.equals(anApiCode);
    }

    @Override
    public boolean checkParam(Map<String, Object> anParamMap) {

        boolean flag = true;

        if (flag && Collections3.isEmpty(anParamMap)) flag = false;

        if (flag && !anParamMap.containsKey("custType")) flag = false;

        return flag;
    }

}
